<template>
  <a-modal v-model="visible" :width="1080" title="选择sms_hot_key" @ok="batchSelectItem">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
      <a-row :gutter="24">
        </a-row>
        </a-form>
        </div>
        <!-- 查询区域-END -->

        <!-- table区域-begin -->
<div>

<a-table
ref="table"
size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:selectionType}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
        v-else
        :ghost="true"
        type="primary"
        icon="download"
        size="small"
@click="downloadFile(text)">
下载
</a-button>
        </template>

<span slot="action" slot-scope="text, record">
<a v-if="selectionType=='radio'" @click="selectItem(record)">选择</a>
        </span>

        </a-table>
        </div>

        </a-modal>
        </template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/MyJeecgListMixin'


        export default {
        name: 'SmsHotKeyList',
        mixins:[JeecgListMixin, mixinDevice],
        components: {
        },
        data () {
        return {
        pageCheckedKeys: [],
        noPageCheckedKeys: [],
        pageCheckedRows: [],
        noPageCheckedRows: [],
        visible:false,
        description: 'sms_hot_key管理页面',
        // 表头
        columns: [
        {
        title: '#',
        dataIndex: '',
        key:'rowIndex',
        width:60,
        align:"center",
        customRender:function (t,r,index) {
        return parseInt(index)+1;
        }
        },
        {
        title:'热词',
        align:"center",
        dataIndex: 'keywords'
        },
        {
        title:'热门（0，正常 1，热门）',
        align:"center",
        dataIndex: 'isHot'
        },
        {
        title:'搜索次数',
        align:"center",
        dataIndex: 'count'
        },
        {
        title:'排序',
        align:"center",
        dataIndex: 'sequence'
        },
        {
        title:'状态（1启用，0不启用）',
        align:"center",
        dataIndex: 'status'
        },
        {
        title:'删除状态（0，正常，1已删除）',
        align:"center",
        dataIndex: 'delFlag'
        },
        {
        title: '操作',
        dataIndex: 'action',
        align:"center",
        scopedSlots: { customRender: 'action' }
        }
        ],
        url: {
        list: "/shop/smsHotKey/list",
        delete: "/shop/smsHotKey/delete",
        deleteBatch: "/shop/smsHotKey/deleteBatch",
        exportXlsUrl: "/shop/smsHotKey/exportXls",
        importExcelUrl: "shop/smsHotKey/importExcel",

        },
        dictOptions:{},
        }
        },
        created() {
        },
        computed: {
        importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
        },
        },
        methods: {
        open () {
        this.loadData()
        },
        setSelected () {
        this.pageCheckedKeys = []
        this.noPageCheckedKeys = []
        this.pageCheckedRows = []
        this.noPageCheckedRows = []
        for (let i = 0; i < this.checkedKeys.length; i++) {
        let isSelect = false
        for (let j = 0; j < this.dataSource.length; j++) {
        if (this.dataSource[j].id == this.checkedKeys[i]) {
        isSelect = true
        }
        }
        if (isSelect) {
        this.pageCheckedKeys.push(this.checkedKeys[i])
        this.pageCheckedRows.push(this.checkedRows[i])
        } else {
        this.noPageCheckedKeys.push(this.checkedKeys[i])
        this.noPageCheckedRows.push(this.checkedRows[i])
        }
        }
        this.selectedRowKeys = this.pageCheckedKeys
        },
        initDictConfig(){
        }
        }
        }
        </script>
<style scoped>
@import '~@assets/less/common.less';
</style>
